10 REM CHANGE LEAGUE MASTER FILES          (CHANGE)
12 REM Developed by William W. Klaproth,  Moraga Ca.  94556    September 1982
20 REM MASTER FILE DESCRIPTIONS FOR ALL BOWLING PROGRAMS
30 OPEN "B:TEAMS.HDR" AS #1 LEN = 64
40 FIELD #1, 2 AS TM$, 30 AS NAM$, 2 AS RCNT$, 2 AS GAM$, 4 AS PINS$, 2 AS AVG$, 2 AS HIG$, 2 AS HIS$, 4 AS PTSW$, 4 AS PTSL$, 2 AS B1ID$, 2 AS B2ID$, 2 AS B3ID$, 2 AS B4ID$, 2 AS B5ID$
50 FIELD #1, 2 AS HDRID$, 30 AS LEAGUE$, 2 AS WEEKS$, 2 AS TEAMS$, 4 AS FILLER$, 2 AS BWLPERTM$, 2 AS NXTID$, 2 AS HCPBASE$, 4 AS HCPPCNT$
60 OPEN "B:BOWLERS.HDR" AS #2 LEN = 64
70 FIELD #2, 2 AS BBO$, 30 AS BNAM$, 2 AS BRCNT$, 2 AS BGAM$, 4 AS BPINS$, 2 AS BAVG$, 2 AS BHIG$, 2 AS BHIS$, 2 AS BHCP$, 2 AS BHIGH$, 2 AS BHISH$, 2 AS BTM$,2 AS GAM2$, 2 AS SER5$, 2 AS SER6$,2 AS CURSER$,2 AS AVGLSTYR$
80 REM OPEN "B:TEAM.DET" AS #3 LEN = 16
90 REM FIELD #3,2 AS DTM$, 2 AS TMO$, 2 AS TDAY$, 2 AS TG1$, 2 AS TG2$, 2 AS TG3$, 2 AS TSER$, 2 AS DPTSW$
100 REM OPEN "B:BOWLER.DET" AS #4 LEN = 16
110 REM FIELD #4,2 AS DBO$, 2 AS BMO$, 2 AS BDAY$, 2 AS BG1$, 2 AS BG2$, 2 AS BG3$, 2 AS BSER$
120 CLS
130 PRINT "MASTER FILE UPDATE PROGRAM"
140 PRINT " "
150 CHGSW$ = "OFF"
160 BCHGSW$ = "OFF"
170 GOSUB 2750  'Get League Header
180 PRINT "          Update Task Selection"
190 PRINT "             1 - Change League Header"
200 PRINT "             2 - Change Team or Bowler Header Records"
210 PRINT "             3 - Add new substitutes"
220 PRINT "             4 - End Update Program"
230 PRINT " "
240 INPUT "Enter number of function desired:",ANS$
250 IF ANS$ = "1" GOTO 300
260 IF ANS$ = "2" GOTO 630
270 IF ANS$ = "3" GOTO 2420
280 IF ANS$ = "4" GOTO 1510
290 PRINT "Invalid choice - please reenter": GOTO 240
300 CLS: PRINT "MASTER FILE UPDATE PROGRAM": PRINT " "
310 GOSUB 2750   'Get League Header
320 PRINT "LEAGUE NAME (1):";NAM$
330 PRINT "WEEKS(2)  TEAMS(3)   B/TM(4)   NEXT ID  HBASE(5)  HCP %(6)"
340 PCNT = CVS(HCPPCNT$)
350 PCNT% = INT(PCNT)
360 PRINT USING "     ###  ";CVI(WEEKS$);CVI(TEAMS$);CVI(BWLPERTM$);CVI(NXTID$);CVI(HCPBASE$);PCNT%
370 INPUT "ENTER FIELD NO (or 0 to end this function):",F%
380 IF F% = 0 GOTO 610
390 IF F% > 6 GOTO 590
400 ON F% GOSUB 410,440,470,500,530,560
410 INPUT "ENTER NEW LEAGUE NAME";INAM$
420 LSET LEAGUE$=INAM$
430 GOTO 370
440 INPUT "ENTER NO OF WEEKS:",IWK%
450 RSET WEEKS$=MKI$(IWK%)
460 GOTO 370
470 INPUT "ENTER NO OF TEAMS:",ITM%
480 RSET TEAMS$=MKI$(ITM%)
490 GOTO 370
500 INPUT "ENTER BOWLERS PER TEAM:",IBO%
510 RSET BWLPERTM$=MKI$(IBO%)
520 GOTO 370
530 INPUT "ENTER HANDICAP BASE:";BASE%
540 RSET HCPBASE$ = MKI$(BASE%)
550 GOTO 370
560 INPUT "ENTER HANDICAP PERCENTAGE:";PCNT
570 RSET HCPPCNT$ = MKS$(PCNT)
580 GOTO 370
590 PRINT "INVALID FIELD NUMBER SPECIFIED"
600 GOTO 370
610 PUT #1,1
620 GOTO 120
630 CLS: PRINT "MASTER FILE UPDATE PROGRAM"
640 PRINT "MODIFY TEAM OR BOWLER HEADER RECORDS"
650 INPUT "ENTER TEAM NUMBER TO BE CHANGED:",IT%
660 IF IT% = 0 GOTO 650
670 CLS
680 TMNUM% = IT% + 1
690 GET #1, TMNUM%
700 PRINT "HEADER RECORD FOR TEAM NO ";IT%
710 PRINT "TEAM NAME(1):";NAM$
720 PRINT "CNT(2)  GAM)3)  TPN(4)  AVG(5)  HIG(6)  HIS(7)"
730 PRINT USING " #####  ";CVI(RCNT$),CVI(GAM$),CVS(PINS$),CVI(AVG$),CVI(HIG$),CVI(HIS$)
740 PRINT "GAMES WON(8)  GAMES LOST(9)"
750 PRINT USING "       ###.#";CVS(PTSW$),CVS(PTSL$)
760 PRINT "B#1(10) B#2(11) B#3(12) B#4(13) B#5(14)"
770 PRINT USING "   ###  ";CVI(B1ID$),CVI(B2ID$),CVI(B3ID$),CVI(B4ID$),CVI(B5ID$)
780 INPUT "ENTER FIELD NO TO BE CHANGED, (or 0 to end this function):",F%
790 IF F% = 0 GOTO 1280
800 IF F% > 14 GOTO 1240
810 ON F% GOSUB 820, 850, 880, 910,940,970,1000,1030,1060,1090,1120,1150,1180,1210
820 INPUT "ENTER NEW TEAM NAME:",INAM$
830 LSET NAM$=INAM$
840 GOTO 1260
850 INPUT "ENTER COUNT:",ICNT%
860 RSET RCNT$=MKI$(ICNT%)
870 GOTO 1260
880 INPUT "ENTER GAMES:",IGAM%
890 RSET GAM$=MKI$(IGAM%)
900 GOTO 1260
910 INPUT "ENTER TOTAL PINS:",IPINS
920 RSET PINS$=MKS$(IPINS)
930 GOTO 1260
940 INPUT "ENTER AVERAGE:",IAVG%
950 RSET AVG$=MKI$(IAVG%)
960 GOTO 1260
970 INPUT "ENTER HI GAME:",IHIG%
980 RSET HIG$=MKI$(IHIG%)
990 GOTO 1260
1000 INPUT "ENTER HI SERIES:",IHIS%
1010 RSET HIS$=MKI$(IHIS%)
1020 GOTO 1260
1030 INPUT "ENTER TEAM GAMES WON:";IPTSW
1040 RSET PTSW$=MKS$(IPTSW)
1050 GOTO 1260
1060 INPUT "ENTER TEAM GAMES LOST:";IPTSL
1070 RSET PTSL$=MKS$(IPTSL)
1080 GOTO 1260
1090 INPUT "ENTER NEW BOWLER NO FOR POSITION 1:",IB1ID%
1100 RSET B1ID$ = MKI$(IB1ID%)
1110 GOTO 1260
1120 INPUT "ENTER NEW BOWLER NO FOR POSITION 2:",IB2ID%
1130 RSET B2ID$ = MKI$(IB2ID%)
1140 GOTO 1260
1150 INPUT "ENTER NEW BOWLER NO FOR POSITION 3:",IB3ID%
1160 RSET B3ID$ = MKI$(IB3ID%)
1170 GOTO 1260
1180 INPUT "ENTER NEW BOWLER NO FOR POSITION 4:",IB4ID%
1190 RSET B4ID$ = MKI$(IB4ID%)
1200 GOTO 1260
1210 INPUT "ENTER NEW BOWLER NO FOR POSITION 5:",IB5ID%
1220 RSET B5ID$ = MKI$(IB5ID%)
1230 GOTO 1260
1240 PRINT "INVALID FIELD NUMBER SPECIFIED"
1250 GOTO 780
1260 CHGSW$ = "ON "
1270 GOTO 780
1280 IF CHGSW$ = "ON " GOTO 1300
1290 GOTO 1450
1300 CLS
1310 PRINT "NEW HEADER RECORD FOR TEAM NO ";IT%
1320 PRINT "TEAM NAME(1):";NAM$
1330 PRINT "CNT(2)  GAM)3)  TPN(4)  AVG(5)  HIG(6)  HIS(7)"
1340 PRINT USING " #####  ";CVI(RCNT$),CVI(GAM$),CVS(PINS$),CVI(AVG$),CVI(HIG$),CVI(HIS$)
1350 PRINT "GAMES WON(8)  GAMES LOST(9)"
1360 PRINT USING "       ###.#";CVS(PTSW$),CVS(PTSL$)
1370 PRINT "B#1(10) B#2(11) B#3(12) B#4(13) B#5(14)"
1380 PRINT USING "   ###  ";CVI(B1ID$),CVI(B2ID$),CVI(B3ID$),CVI(B4ID$),CVI(B5ID$)
1390 INPUT "DO YOU WISH TO MAKE ADDITIONAL CHANGES? Y/N:";A$
1400 IF A$ = "Y" GOTO 780
1410 IF A$ = "y" GOTO 780
1420 PUT #1,TMNUM%
1430 CHGSW$ = "OFF"
1440 REM BEGINING OF REGULAR BOWLER CHANGE ROUTINE
1450 GOSUB 1540
1460 GOTO 620
1470 REM BEGINNING OF SUB CHANGE ROUTINE
1480 PRINT "SUBSTITUTE CHANGE PROCESSING"
1490 GOSUB 1540
1500 GOTO 620
1510 PRINT "Change Processing Completed - Returning to MENU"
1520 CLOSE
1530 RUN "A:MENU"
1540 REM BEGINING OF BOWLER HEADER CHANGE SUBROUTINE
1550 INPUT "ENTER BOWLER NUMBER TO BE CHANGED, (or 0 to end this function):",IB%
1560 IF IB% = 0 GOTO 2400
1570 BONUM% = IB%
1580 GET #2,BONUM%
1590 BCHGSW$ = "OFF"
1600 PRINT " "
1610 PRINT "HEADER FOR BOWLER NO ";IB%;"NAME(1):";BNAM$
1620 PRINT "   2    3     4    5    6    7    8    9   10   11   12   13   14   15   16"
1630 PRINT "  CNT  GAM   PIN  AVG  HIG  HIS  HCP  HGH  HSH  TM#  200  500  600  SER PAVG"
1640 PRINT USING "  ###";CVI(BRCNT$),CVI(BGAM$);
1650 PRINT USING " #####";CVS(BPINS$);
1660 PRINT USING "  ###";CVI(BAVG$),CVI(BHIG$),CVI(BHIS$),CVI(BHCP$),CVI(BHIGH$),CVI(BHISH$),CVI(BTM$),CVI(GAM2$),CVI(SER5$),CVI(SER6$),CVI(CURSER$),CVI(AVGLSTYR$)
1670 INPUT "ENTER FIELD NO TO BE CHANGED, (or 0 to end this function):",F%
1680 IF F% = 0 GOTO 2250
1690 IF F% > 16 GOTO 2190
1700 ON F% GOTO 1710,1740,1770,1800,1830,1860,1890,1920,1950,1980,2010,2040,2070,2100,2130,2160
1710 INPUT "ENTER NEW BOWLER NAME:",INAM$
1720 LSET BNAM$=INAM$
1730 GOTO 2230
1740 INPUT "ENTER COUNT:",ICNT%
1750 RSET BRCNT$=MKI$(ICNT%)
1760 GOTO 2230
1770 INPUT "ENTER GAMES:",IGAM%
1780 RSET BGAM$=MKI$(IGAM%)
1790 GOTO 2230
1800 INPUT "ENTER TOTAL PINS:",IPINS
1810 RSET BPINS$=MKS$(IPINS)
1820 GOTO 2230
1830 INPUT "ENTER AVERAGE:",IAVG%
1840 RSET BAVG$=MKI$(IAVG%)
1850 GOTO 2230
1860 INPUT "ENTER HI GAME:",IHIG%
1870 RSET BHIG$=MKI$(IHIG%)
1880 GOTO 2230
1890 INPUT "ENTER HI SERIES:",IHIS%
1900 RSET BHIS$=MKI$(IHIS%)
1910 GOTO 2230
1920 INPUT "ENTER HANDICAP:",IHCP%
1930 RSET BHCP$=MKI$(IHCP%)
1940 GOTO 2230
1950 INPUT "ENTER HIGH HANDICAP GAME:",IBHIGH%
1960 RSET BHIGH$ = MKI$(IBHIGH%)
1970 GOTO 2230
1980 INPUT "ENTER HIGH HANDICAP SERIES:",IBHISH%
1990 RSET BHISH$ = MKI$(IBHISH%)
2000 GOTO 2230
2010 INPUT "ENTER NEW ASSIGNED TEAM NO:";ITEAM%
2020 RSET BTM$ = MKI$(ITEAM%)
2030 GOTO 2230
2040 INPUT "ENTER NO OF 200 GAMES:",IGAM2%
2050 RSET GAM2$ = MKI$(IGAM2%)
2060 GOTO 2230
2070 INPUT "ENTER NO OF 500 SERIES:",ISER5%
2080 RSET SER5$ = MKI$(ISER5%)
2090 GOTO 2230
2100 INPUT "ENTER NO OF 600 SERIES:",ISER6%
2110 RSET SER6$ = MKI$(ISER6%)
2120 GOTO 2230
2130 INPUT "ENTER CURRENT SERIES:",ICURSER%
2140 RSET CURSER$ = MKI$(ICURSER%)
2150 GOTO 2230
2160 INPUT "ENTER AVERAGE LAST YEAR:",IAVGLSTYR%
2170 RSET AVGLSTYR$ = MKI$(IAVGLSTYR%)
2180 GOTO 2230
2190 PRINT "INVALID FIELD NUMBER SPECIFIED"
2200 GOTO 1670
2210 PRINT "INVALID BOWLER NUMBER"
2220 GOTO 1550
2230 BCHGSW$ = "ON "
2240 GOTO 1670
2250 IF BCHGSW$ = "ON " GOTO 2270
2260 GOTO 1550
2270 CLS
2280 PRINT "NEW HEADER FOR BOWLER NO ";IB%;"NAME(1):";BNAM$
2290 PRINT "   2    3     4    5    6    7    8    9   10   11   12   13   14   15   16"
2300 PRINT "  CNT  GAM   PIN  AVG  HIG  HIS  HCP  HGH  HSH  TM#  200  500  600  SER PAVG"
2310 PRINT USING "  ###";CVI(BRCNT$),CVI(BGAM$);
2320 PRINT USING " #####";CVS(BPINS$);
2330 PRINT USING "  ###";CVI(BAVG$),CVI(BHIG$),CVI(BHIS$),CVI(BHCP$),CVI(BHIGH$),CVI(BHISH$),CVI(BTM$),CVI(GAM2$),CVI(SER5$),CVI(SER6$),CVI(CURSER$),CVI(AVGLSTYR$)
2340 INPUT "DO YOU WISH TO MAKE ADDITIONAL CHANGES? Y/N:";ANS$
2350 IF ANS$ = "Y" GOTO 1670
2360 IF ANS$ = "y" GOTO 1670
2370 PUT #2,BONUM%
2380 BCHGSW$ = "OFF"
2390 GOTO 1550
2400 RETURN
2410 REM Routine to add new substitutes to file
2420 BID% = CVI(NXTID$)
2430 CLS
2440 PRINT "SUBSTITUTE NO:";BID%
2450 PRINT "Enter sub name and telephone number (align telephone number under mask.         To quit, enter *END in first four positions of name."
2460 PRINT "            ....................(TEL-XXXX)"
2470 INPUT "BOWLER NAME:",INAM$
2480 IF LEFT$(INAM$,4) = "*END" OR LEFT$(INAM$,4) = "*end" GOTO 2700
2490 INPUT "ENTER AVERAGE LAST YEAR:";IAVGLSTYR%
2500 LSET BNAM$ = INAM$
2510 RSET BRCNT$ = MKI$(0)
2520 RSET BGAM$ = MKI$(0)
2530 RSET BPINS$ = MKS$(0)
2540 RSET BAVG$ = MKI$(0)
2550 RSET BHIG$ = MKI$(0)
2560 RSET BHIS$ = MKI$(0)
2570 RSET BHCP$ = MKI$(0)
2580 RSET BHIGH$ = MKI$(0)
2590 RSET BHISH$ = MKI$(0)
2600 RSET BTM$ = MKI$(0)
2610 RSET GAM2$ = MKI$(0)
2620 RSET SER5$ = MKI$(0)
2630 RSET SER6$ = MKI$(0)
2640 RSET CURSER$ = MKI$(0)
2650 RSET AVGLSTYR$ = MKI$(IAVGLSTYR%)
2660 RSET BBO$ = MKI$(BID%)
2670 PUT #2,BID%
2680 BID% = BID% + 1
2690 GOTO 2430
2700 GOSUB 2750  'Get League Header
2710 RSET NXTID$ = MKI$(BID%)
2720 PUT #1,1
2730 CLS: GOTO 120
2740 REM Subroutine to read League header and store next available bowler ID
2750 GET #1,1
2760 NEXTID% = CVI(NXTID$)
2770 RETURN
